function fetch_object(idname)
{
	if (document.getElementById)
	{
		return document.getElementById(idname);
	}
	else if (document.all)
	{
		return document.all[idname];
	}
	else if (document.layers)
	{
		return document.layers[idname];
	}
	else
	{
		return null;
	}
}

function flip_visibility(idname, force_visibility)
{
	var obj = fetch_object(idname);
	if (!obj)
	{
		return false;
	}

	if (typeof force_visibility != 'undefined')
	{
		obj.style.display = force_visibility;
	}
	else if (obj.style.display == '')
	{
		obj.style.display = 'none';
	}
	else
	{
		obj.style.display = '';
	}
	return true;
}

function setze_keks (keksname, kekswert)
{
	var a = new Date();
	a = new Date(a.getTime() +1000*60*60*24*365);
	document.cookie = keksname+'='+kekswert+'; expires='+a.toGMTString()+';'; 
}
function xxopen_check ()
{
a = document.cookie;
 res = '';
 while(a != '')
 {
  cookiename = a.substring(0,a.search('='));
  cookiewert = a.substring(a.search('=')+1,a.search(';'));
  if(cookiewert == '')
  {cookiewert = a.substring(a.search('=')+1,a.length);}

  if(cookiename == 'aktivflip'){res = cookiewert;}

  i = a.search(';')+1;
  if(i == 0){i = a.length}
  a = a.substring(i,a.length);
 }
 Effect.toggle(res, 'BLIND');
 Effect.toggle(res, 'BLIND');
 //flip_visibility (res);
// return(res)
}
var cookieWert = 'kkk';

function holeCookie(Keksname)
{
	var alleCookies;
	var cookieArr;
	alleCookies=document.cookie;
	cookieArr=alleCookies.split(";");
	for(var i=0;i<cookieArr.length;i++)
	{
//		alert('-'+cookieArr[i].split("=")[0]+'- - -'+Keksname+'-');
		if(trim(cookieArr[i].split("=")[0]) == Keksname)
		{
//		 alert(Keksname);
			cookieWert=cookieArr[i].split("=");
			cookieWert=unescape(cookieWert[1]);
			return true;
		}
	}
	return false;
}

function flip_check()
{
	holeCookie('aktivflip');
	if (cookieWert != '')
	{
		 flip_visibility(cookieWert);
		 //Effect.toggle(cookieWert, 'BLIND');
	}
}

function flip_stop()
{
//	holeCookie('aktivflip');
//	if (cookieWert != '')
//	{
	//	 flip_visibility(cookieWert, 'none');
//	}
	document.cookie = 'aktivflip=; expires=Thu, 01-Jan-70 00:00:01 GMT;';
	//stop this... with exired keks (verschimmelt ;)
}

function trim(s)
{
 while(s.substring(0,1) == ' ')
 {
  s = s.substring(1,s.length);
 }

 while(s.substring(s.length-1,s.length) == ' ')
 {
  s = s.substring(0,s.length-1);
 }

 return s;
}
